using AutoMapper;
using CustomerManagementSystem.Application.DTOs;
using CustomerManagementSystem.Domain.Entities;

namespace CustomerManagementSystem.Application.Mapping;

public class MappingProfile : Profile
{
    public MappingProfile()
    {
        CreateMap<Customer, CustomerDTO>();
        CreateMap<CustomerDTO, Customer>()
            .ForMember(dest => dest.PasswordHash, opt => opt.Ignore());
            
        CreateMap<RegisterDTO, Customer>()
            .ForMember(dest => dest.PasswordHash, opt => opt.MapFrom(src => src.Password));
    }
}
